<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>

</body>
<script>
  // var arr=[1,2,3,5,4,1,2,3]
  // var arr1=[]
  // for(var i in arr){
  // if (arr1.indexOf(arr[i])==-1)
  // {
  //   arr1.push(arr[i])
  // }
  //
  // }
  // console.log(arr1)


  var arr = [1, 2, 3, 5, 4, 1, 2, 3]
  var arr1 = []
  for (var i = 0; i < arr.length; i++) {
    for (var j = i + 1; j < arr.length; j++)
      if (arr[i] === arr[j]) {
        j = ++i;
      }
    arr1.push(arr[i]);
  }
   console.log(arr1)
</script>

</html>
